using System;

namespace SharpMud.Server.Systems.Security.Entities.BuiltIn.Roles
{
	/// <summary>
	/// Represents a group of administrative users
	/// </summary>
	public class Administrators : Systems.Security.Entities.IUserRole, Systems.Security.Entities.IEntity
	{
		private const string	_RoleName	=	"Administrators";
		private const string	_RoleIDSeed	=	"{ECABCE27-C9EB-4b84-A8A6-F791DD47DAED}";

		private SecurityManager _SecurityManager;
		private System.Guid _RoleID;

		#region Public Constructors
		public Administrators()
			:this(SecurityManager.GlobalInstance)
		{
		}

		public Administrators(SecurityManager securityManager)
		{
			if(securityManager==null)
				throw new InvalidOperationException("There must be an instance of SharpMud.Server.Systems.SecurityManager available to this IUser");
			_SecurityManager = securityManager;
			this._RoleID = Security.Utility.AddGuids(securityManager.HostApp.___AppID, new System.Guid(_RoleIDSeed));
		}
		#endregion

		
		#region IUserRole Members

		public UserRoleReference GetReference()
		{
			return new UserRoleReference((IUserRole)this);
		}

		#endregion

		#region IEntity Members

		public string Name
		{
			get
			{
				return _RoleName;
			}
		}

		public Guid ID
		{
			get
			{
				return this._RoleID;
			}
		}

		EntityReference SharpMud.Server.Systems.Security.Entities.IEntity.GetReference()
		{
			return new EntityReference((IEntity)this);
		}

		#endregion
	}
}
